package model;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JButton;
import javax.swing.JComponent;
import noname.ConfigSettings;

/**
 * Audio implementatie van MultiMedia.
 */
public class AudioMultiMedia extends MultiMedia {

    public AudioMultiMedia(String number) {
        super(number);
    }
    
    @Override
    public JComponent getView() {
        JButton button = new JButton("Play audio");
        button.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                try {
                    Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + ConfigSettings.getInstance().getMultimediaAudioPath() + number + ".mp3");
                } catch (IOException ex) {
                    Logger.getLogger(VideoMultiMedia.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
        
        return button;
    }

    @Override
    public String getName() {
        return "Audio-" + number;
    }
    
}
